import React, { Component } from 'react'
import TabBar from '../common/TabBar'
import { Link } from 'react-router-dom'
import Header from '../common/Header'

import { connect } from 'react-redux';

class My extends Component {
    render() {
        return (
            <div className="my-page">
                <Header title="我的"></Header>
                
                <div className="cell">
                    <div>我的红包</div>
                    <div>3个 ></div>
                </div>
                <div className="cell">
                    <div>我的津贴</div>
                    <div>¥20 ></div>
                </div>
                <Link className="cell" to="/addresslist">
                    <div>我的地址</div>
                    <div>{this.props.defaultAddress.address ? this.props.defaultAddress.address :'这个人比较懒,没有设置默认地址!'} ></div>
                </Link>
                <Link className="cell" to="/collect">
                    <div>我的收藏</div>
                    <div> { this.props.collectList.length||'这个人比较懒,还没有收藏!' } ></div>
                </Link>
                <div className="cell">
                    <div>我的客服 </div>
                    <div>></div>
                </div>
                {/* tabbar组件 */}
                <TabBar></TabBar>
            </div>
        )
    }
}

export default connect(
    (state) => {//注入数据
        return {
            collectList: state.collectList,
            defaultAddress: state.defaultAddress
        }
    },
    (dispatch) => {//注入方法
        return {

        }
    }
)( My )
